function [ s ] = squareDistance( x, y, z )
% computes square distance of all trap locations

N = length(x);

s = 0;
for i = 1:N
    for j = i+1:N
        s = s + (x(i)-x(j))^2 + (y(i)-y(j))^2 + (z(i) - z(j))^2;
    end
end

end

